Skip to main content

Java

Getting started with Java

To use the API with Java use the following example

Using OKHTTP

    OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"api_key\":\"777XXXXXXXXXXXXXXXXXXXAWVwNpSM=\",\"pc\":\"HOME006\"}");
Request request = new Request.Builder()
.url("https://apiv1.pataa.com/get-pataa")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();

Using Unirest

    Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://apiv1.pataa.com/get-pataa")
.header("Content-Type", "application/json")
.body("{\"api_key\":\"777XXXXXXXXXXXXXXXXXXXAWVwNpSM=\",\"pc\":\"HOME006\"}")
.asString();